package com.zhu.service;

import com.zhu.mapper.CustomerMapper;
import com.zhu.pojo.Customer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class CustomerService {
    @Autowired
    private CustomerMapper customerMapper;

    public void insert(Customer customer){
        customerMapper.insert(customer);
    }

    public Customer select(String customer_name){
        return customerMapper.selectByName(customer_name);
    }
    public void update(Customer c){
        customerMapper.updateById(c);
    }
    public Integer selectIdByName(String customer_name){
        return customerMapper.selectIdByName(customer_name);
    }

    public List<Map<String,Object>> getCustomerStatistics() {return customerMapper.getCustomerStatistics();}

    public List<Map<String,Object>> searchAll(String name){return customerMapper.searchAll( name);}

    public void delete(String name){  customerMapper.delete(name);}
}
